#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define print(a,nn,m) {\
	int i, j;\
	for(i=0;i<nn;i++){\
		printf("%4d",a[i]);\
		if((i+1)%m==0){\
			printf("\n");\
		}\
	}\
} 

void rand(int a[],int nn ,int m ){
	int i, num, j;	
	srand((unsigned)time(NULL));
	for(i=0;i<nn;i++){
		num=rand()%100;
		a[i]=num;
	}
}

int main(){
	int a[1000];
	int nn=51,m=6;
	rand(a,nn,m);
	print(a,nn,m)
}
